<template>
  <div class="login-container2" ref="login" @keyup.enter.native="handleLogin">
    <div class="flex-dcc position-center" style="min-width: 1200px;">
      <div style="min-height: 100px;">
        <div class="flex-dcc">
          <img class="logo" src="./logo2.png" alt="" >
        </div>
        <div class="title">欢迎登录云素品控管理平台</div>
      </div>
      <div class="login-card">
        <h4 class="login-title">登录账号</h4>
        <userLogin v-if="activeName==='user'"/>
        <codeLogin v-else-if="activeName==='code'"/>
        <thirdLogin v-else-if="activeName==='third'"/>
      </div>
    </div>
    <!--    <div class="login-weaper">-->
    <!--      <div class="login-border">-->
    <!--        <div class="login-main">-->
    <!--          <h4 class="login-title">登录账号</h4>-->
    <!--          <userLogin v-if="activeName==='user'"/>-->
    <!--          <codeLogin v-else-if="activeName==='code'"/>-->
    <!--          <thirdLogin v-else-if="activeName==='third'"/>-->
    <!--&lt;!&ndash;          <div class="login-menu">&ndash;&gt;-->
    <!--&lt;!&ndash;            <a href="#"&ndash;&gt;-->
    <!--&lt;!&ndash;               @click.stop="activeName='user'">{{ $t('login.userLogin') }}</a>&ndash;&gt;-->
    <!--&lt;!&ndash;            <a href="#"&ndash;&gt;-->
    <!--&lt;!&ndash;               @click.stop="activeName='code'">{{ $t('login.phoneLogin') }}</a>&ndash;&gt;-->
    <!--&lt;!&ndash;            <a href="#"&ndash;&gt;-->
    <!--&lt;!&ndash;               @click.stop="activeName='third'">{{ $t('login.thirdLogin') }}</a>&ndash;&gt;-->
    <!--&lt;!&ndash;          </div>&ndash;&gt;-->
    <!--        </div>-->
    <!--      </div>-->
    <!--    </div>-->
  </div>
</template>
<script>
import userLogin from "./userlogin";
import codeLogin from "./codelogin";
import thirdLogin from "./thirdlogin";
import {mapGetters} from "vuex";
import {dateFormat} from "@/util/date";
import {validatenull} from "@/util/validate";
import topLang from "@/page/index/top/top-lang";
import topColor from "@/page/index/top/top-color";

export default {
  name: "login",
  components: {
    userLogin,
    codeLogin,
    thirdLogin,
    topLang,
    topColor
  },
  data() {
    return {
      time: "",
      activeName: "user"
    };
  },
  watch: {
    $route() {
      const params = this.$route.query;
      this.socialForm.state = params.state;
      this.socialForm.code = params.code;
      if (!validatenull(this.socialForm.state)) {
        const loading = this.$loading({
          lock: true,
          text: `${
            this.socialForm.state === "WX" ? "微信" : "QQ"
          }登录中,请稍后。。。`,
          spinner: "el-icon-loading"
        });
        setTimeout(() => {
          loading.close();
        }, 2000);
      }
    }
  },
  created() {
    this.getTime();
    setInterval(() => {
      this.getTime();
    }, 1000);
  },
  mounted() {
  },
  computed: {
    ...mapGetters(["website"])
  },
  props: [],
  methods: {
    getTime() {
      this.time = dateFormat(new Date());
    }
  }
};
</script>

<style lang="scss">
@import "@/styles/login.scss";

.login-container2 {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  background-image: url(bg.png);
  background-size: 100% 100%;

}
.position-center {
  margin-top: -60px;
}

.flex-dcc {
  display: flex;
  align-items: center;
  flex-direction: column;
}

.login-card {
  background-color: #FFFFFF;
  padding: 30px;
  width: 400px;
  border-radius: 5px;
}

.title {
  font-size: 36px;
  letter-spacing: 10px;
  color: #FFFFFF;
  margin: 40px;
}

.logo {
  width: 200px;
  height: 42px;
  filter: grayscale(100%) brightness(300%)
}

</style>
